package com.atguigu.responsibilitychain.demo;

public class Client {

	public static void main(String[] args) {
		// 创建一个请求
		PurchaseRequest purchaseRequest = new PurchaseRequest(1, 31000, 1);

		// 创建相关的审批人
		ApproverForDepart departmentApprover = new ApproverForDepart("张主任");
		ApproverForCollege collegeApprover = new ApproverForCollege("李院长");
		ApproverForViceSchoolMaster viceSchoolMasterApprover = new ApproverForViceSchoolMaster("王副校");
		ApproverForSchoolMaster schoolMasterApprover = new ApproverForSchoolMaster("佟校长");

		// 需要将各个审批级别的下一个设置好 (处理人构成环形: )
		departmentApprover.setApprover(collegeApprover);
		collegeApprover.setApprover(viceSchoolMasterApprover);
		viceSchoolMasterApprover.setApprover(schoolMasterApprover);
		schoolMasterApprover.setApprover(departmentApprover);// 设置环状

		// 从 教学主任 开始审批
		// departmentApprover.processRequest(purchaseRequest);

		// 从 佟校长 ，开始审批，由于是环状，依然可以审批
		viceSchoolMasterApprover.processRequest(purchaseRequest);
	}

}
